<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
if (sizeof($pages) > 0) {
	echo "<div>";
	foreach ($pages as $page) {
		echo "<div class='catalog-brand-item'>";
			echo "<div class='image'>";
			$parent_link = "/".$url."/".$page['brand_id']."/";
				echo "<a href='".$parent_link."'>";
					if ($page['brand_image'] != "" && file_exists("./uploads/catalog_brands/".$page['brand_id']."/middle/".$page['brand_image'])) {
						$im = getimagesize("./uploads/catalog_brands/".$page['brand_id']."/middle/".$page['brand_image']);
						$margin = round((200 - $im[1]) / 2);
						echo "<img src='/uploads/catalog_brands/".$page['brand_id']."/middle/".$page['brand_image']."' alt='".$page['brand_title']."' title='".$page['brand_title']."' style='margin: ".$margin."px 0 0 0;' />";
					} else {
						echo "<img src='/data/images/x.gif' alt='".$page['brand_title']."' title='".$page['brand_title']."' />";
					}
				echo "</a>";
			echo "</div>";
			echo "<div class='name'>";
				echo "<a href='".$parent_link."'>".$page['brand_title'];
				echo "</a>";
			echo "</div>";
		echo "</div>";
	}
	echo "</div>";
	echo "<br class='cc'/>";
} else {
	echo showmenotice('Категория пуста');
}